#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import rospy
from mqtt_integration.msg import TimeInfo  # 确保使用您的包名

def time_info_callback(msg):
    print(f"收到的当前时间: {msg.current_time}, 经过时长: {msg.elapsed_time}")

def main():
    # 初始化ROS节点
    rospy.init_node('time_subscriber')
    rospy.Subscriber('time_info', TimeInfo, time_info_callback)
    
    rospy.spin()

if __name__ == "__main__":
    main()
